#include <iostream>
using namespace std;

/*
    函数带默认参数
        C++ 函数允许我们为参数提供默认值。(可以全带默认值，也可以全不带默认值)
            提供默认值的时候必须从右到左连续，不可以跳跃；
            int fun(int n1, float n2,char n3 ='b' ,double n4 = 10.1)        可以
            int fun(int n1 = 10, float n2,char n3 ='b' ,double n4 = 10.1)   不可以
        传递实参时，必须从左到右连续传递，不可以跳跃
            fun(10,10.1,'a',88.8);      正确
            fun(10,10.1,,10.2);         错误

        
*/

int fun(int n1 = 10, float n2 = 20.1, char n3 = 'b', double n4 = 10.1)
{
    cout << "n1 = " << n1 << endl;
    cout << "n2 = " << n2 << endl;
    cout << "n3 = " << n3 << endl;
    cout << "n4 = " << n4 << endl;
    return 0;
}
int add(int a = 10 , int b = 20)
{
    cout << "a = " << a << endl;
    cout << "b = " << b << endl;
    cout << "a + b = " << a + b << endl;
    return a + b;
}

int main()
{
    int a = 10, b = 20;

    // fun(a,10.1,'a',88.8);
    fun(30, 2120.1);

    add();
    add(30);
    add(1,2);


    return 0;
}